module.exports = (userMsg)=>{
    return function(req, res, next){
        // 用户名重名，注册失败
        if(userMsg.some(val=>val.username === req.body.username)){
            res.send({
                code:0,
                title:"重名",
                data:""
            })
        }else{
            // 注册成功
            userMsg.push({
                username: req.body.username,
                password: req.body.password
            })
            res.send({
                code:1,
                title:"成功",
                data:"ok"
            })
        }
    }
}